package service;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;

import dao.SearchDAO;

import vo.MenuVO;
import vo.SellerVO;

public class SearchService {
	
	private SearchDAO dao;
	
	public SearchDAO getDAO() {return dao;}
	public void setSearchDAO(SearchDAO dao) {this.dao = dao;}

	public ArrayList<SellerVO> searchByLocation(String location){
		ArrayList<SellerVO> slist = null;
		try {
			slist = dao.searchByLocation(location);
		}catch (SQLException e){
			e.printStackTrace();
		}
		return slist;
	}
	
	public ArrayList<SellerVO> searchByKeyword(String keyword){
		ArrayList<SellerVO> slist = null;
		try {
			slist = dao.searchByKeyword(keyword);
		}catch (SQLException e){
			e.printStackTrace();
		}
		return slist;
	}
	
	public ArrayList<SellerVO> searchByLocationAndFoodtype(HashMap<String, String> map) {
		ArrayList<SellerVO> slist = null;
		try {
			slist = dao.searchByLocationAndFoodtype(map);
		}catch (SQLException e){
			e.printStackTrace();
		}
		return slist;
	}
	
	public ArrayList<MenuVO> selectByProduct(String member_id) {
		ArrayList<MenuVO> mlist = null;
		try {
			System.out.println(member_id+"service");
			mlist = dao.selectByProduct(member_id);
		}catch (SQLException e){
			e.printStackTrace();
		}
		return mlist;
	}
	
	public SellerVO selectBySeller(String member_id) {
		SellerVO svo = null;
		try {
			svo = (SellerVO)dao.selectBySeller(member_id);
		}catch (SQLException e){
			e.printStackTrace();
		}
		return svo;
	}
	
}